<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Vue示例</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/3.2.40/vue.global.js"></script>
  </head>
  <body>
    <div id="app">
      <div @click.self="func2">
        <div>
          <button @click="func($event)">按钮1</button>
          <button @click="func($event)">按钮2</button>
          <button @click.stop.once="func($event)">按钮3</button>
        </div>
      </div>
      <a :href="url" @click.prevent="func2">百度</a>
      <input type="text" @keyup.enter="func2" />
      <input type="text" @keyup.ctrl.b="func2" />
    </div>
    <script>
      const app = Vue.createApp({
        data() {
          return {
            url: "https://www.baidu.com/s?wd=%E4%B9%98K7377%E5%88%97%E8%BD%A6%E9%80%9F%E6%8A%A5%E5%91%8A&ie=UTF-8&tn=62095104_17_oem_dg",
          };
        },
        methods: {
          func(event) {
            console.log(event.target);
            console.log("冒泡中----");
          },
          func2(event) {
            console.log(event.target);
            console.log("冒泡中22222222----");
          },
        },
        computed: {},
        watch: {},
      }).mount("#app");
    </script>
  </body>
</html>
